
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
  
  <!-- Licensed under the Apache 2.0 License -->
  <link rel="stylesheet" type="text/css" href="../../../../_static/fonts/open-sans/stylesheet.css" />
  <!-- Licensed under the SIL Open Font License -->
  <link rel="stylesheet" type="text/css" href="../../../../_static/fonts/source-serif-pro/source-serif-pro.css" />
  <link rel="stylesheet" type="text/css" href="../../../../_static/css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="../../../../_static/css/bootstrap-theme.min.css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
    <title>jmetal.lab.visualization.chord_plot &#8212; jMetalPy 1.5.1 documentation</title>
    <link rel="stylesheet" href="../../../../_static/guzzle.css" type="text/css" />
    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../../../_static/custom.css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../../_static/language_data.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="author" title="About these documents" href="../../../../about.html" />
    <link rel="index" title="Index" href="../../../../genindex.html" />
    <link rel="search" title="Search" href="../../../../search.html" />
  
   

  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../index.html">jMetalPy 1.5.1 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> &#187;</li> 
      </ul>
    </div>
    <div class="container-wrapper">

      <div id="mobile-toggle">
        <a href="#"><span class="glyphicon glyphicon-align-justify" aria-hidden="true"></span></a>
      </div>
  <div id="left-column">
    <div class="sphinxsidebar"><a href="
    ../../../../index.html" class="text-logo">jMetalPy</a>
<div class="sidebar-block">
  <div class="sidebar-wrapper">
    <h2>Table Of Contents</h2>
  </div>
  <div class="sidebar-toc">
    
    
      <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../tutorials.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../multiobjective.algorithms.html">Multi-objective algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../singleobjective.algorithms.html">Single-objective algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../operators.html">Operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../problems.html">Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../about.html">About</a></li>
</ul>

    
  </div>
</div>
<div class="sidebar-block">
  <div class="sidebar-wrapper">
    <div id="main-search">
      <form class="form-inline" action="../../../../search.html" method="GET" role="form">
        <div class="input-group">
          <input name="q" type="text" class="form-control" placeholder="Search...">
        </div>
        <input type="hidden" name="check_keywords" value="yes" />
        <input type="hidden" name="area" value="default" />
      </form>
    </div>
  </div>
</div>
      
    </div>
  </div>
        <div id="right-column">
          
          <div role="navigation" aria-label="breadcrumbs navigation">
            <ol class="breadcrumb">
              <li><a href="../../../../index.html">Docs</a></li>
              
                <li><a href="../../../index.html">Module code</a></li>
              
              <li>jmetal.lab.visualization.chord_plot</li>
            </ol>
          </div>
          
          <div class="document clearer body">
            
  <h1>Source code for jmetal.lab.visualization.chord_plot</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">colorsys</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="k">import</span> <span class="n">List</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">matplotlib</span> <span class="k">import</span> <span class="n">patches</span>
<span class="kn">from</span> <span class="nn">matplotlib</span> <span class="k">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>
<span class="kn">from</span> <span class="nn">matplotlib.path</span> <span class="k">import</span> <span class="n">Path</span>
<span class="kn">from</span> <span class="nn">tqdm</span> <span class="k">import</span> <span class="n">tqdm</span>

<span class="kn">from</span> <span class="nn">jmetal.core.solution</span> <span class="k">import</span> <span class="n">FloatSolution</span>


<div class="viewcode-block" id="polar_to_cartesian"><a class="viewcode-back" href="../../../../tutorials/visualization.html#jmetal.lab.visualization.chord_plot.polar_to_cartesian">[docs]</a><span class="k">def</span> <span class="nf">polar_to_cartesian</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">r</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="n">theta</span><span class="p">),</span> <span class="n">r</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">theta</span><span class="p">)])</span></div>


<div class="viewcode-block" id="draw_sector"><a class="viewcode-back" href="../../../../tutorials/visualization.html#jmetal.lab.visualization.chord_plot.draw_sector">[docs]</a><span class="k">def</span> <span class="nf">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">end_angle</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mf">0.2</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">ls</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">fc</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">ec</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
                <span class="n">z_order</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
    <span class="k">if</span> <span class="n">start_angle</span> <span class="o">&gt;</span> <span class="n">end_angle</span><span class="p">:</span>
        <span class="n">start_angle</span><span class="p">,</span> <span class="n">end_angle</span> <span class="o">=</span> <span class="n">end_angle</span><span class="p">,</span> <span class="n">start_angle</span>
    <span class="n">start_angle</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>
    <span class="n">end_angle</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>

    <span class="c1"># https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves</span>
    <span class="n">opt</span> <span class="o">=</span> <span class="mf">4.</span> <span class="o">/</span> <span class="mf">3.</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">tan</span><span class="p">((</span><span class="n">end_angle</span> <span class="o">-</span> <span class="n">start_angle</span><span class="p">)</span> <span class="o">/</span> <span class="mf">4.</span><span class="p">)</span> <span class="o">*</span> <span class="n">radius</span>
    <span class="n">inner</span> <span class="o">=</span> <span class="n">radius</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">width</span><span class="p">)</span>

    <span class="n">vertsPath</span> <span class="o">=</span> <span class="p">[</span><span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">opt</span><span class="p">,</span> <span class="n">start_angle</span> <span class="o">+</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">opt</span><span class="p">,</span> <span class="n">end_angle</span> <span class="o">-</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">inner</span><span class="p">,</span> <span class="n">end_angle</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">inner</span><span class="p">,</span> <span class="n">end_angle</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">opt</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">width</span><span class="p">),</span> <span class="n">end_angle</span> <span class="o">-</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">inner</span><span class="p">,</span> <span class="n">start_angle</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">opt</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">width</span><span class="p">),</span>
                                                                             <span class="n">start_angle</span> <span class="o">+</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">inner</span><span class="p">,</span> <span class="n">start_angle</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle</span><span class="p">)]</span>

    <span class="n">codesPaths</span> <span class="o">=</span> <span class="p">[</span><span class="n">Path</span><span class="o">.</span><span class="n">MOVETO</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">LINETO</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span>
                  <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CLOSEPOLY</span><span class="p">]</span>

    <span class="k">if</span> <span class="n">ax</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">vertsPath</span><span class="p">,</span> <span class="n">codesPaths</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">path</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="n">vertsPath</span><span class="p">,</span> <span class="n">codesPaths</span><span class="p">)</span>
        <span class="n">patch</span> <span class="o">=</span> <span class="n">patches</span><span class="o">.</span><span class="n">PathPatch</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">facecolor</span><span class="o">=</span><span class="n">fc</span><span class="p">,</span> <span class="n">edgecolor</span><span class="o">=</span><span class="n">ec</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="n">lw</span><span class="p">,</span> <span class="n">linestyle</span><span class="o">=</span><span class="n">ls</span><span class="p">,</span> <span class="n">zorder</span><span class="o">=</span><span class="n">z_order</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">patch</span><span class="p">)</span>
        <span class="k">return</span> <span class="p">(</span><span class="n">patch</span><span class="p">)</span></div>


<div class="viewcode-block" id="draw_chord"><a class="viewcode-back" href="../../../../tutorials/visualization.html#jmetal.lab.visualization.chord_plot.draw_chord">[docs]</a><span class="k">def</span> <span class="nf">draw_chord</span><span class="p">(</span><span class="n">start_angle1</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">end_angle1</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span> <span class="n">start_angle2</span><span class="o">=</span><span class="mi">180</span><span class="p">,</span> <span class="n">end_angle2</span><span class="o">=</span><span class="mi">240</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">chord_width</span><span class="o">=</span><span class="mf">0.7</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
               <span class="n">color</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">z_order</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
    <span class="k">if</span> <span class="n">start_angle1</span> <span class="o">&gt;</span> <span class="n">end_angle1</span><span class="p">:</span>
        <span class="n">start_angle1</span><span class="p">,</span> <span class="n">end_angle1</span> <span class="o">=</span> <span class="n">end_angle1</span><span class="p">,</span> <span class="n">start_angle1</span>
    <span class="k">if</span> <span class="n">start_angle2</span> <span class="o">&gt;</span> <span class="n">end_angle2</span><span class="p">:</span>
        <span class="n">start_angle2</span><span class="p">,</span> <span class="n">end_angle2</span> <span class="o">=</span> <span class="n">end_angle2</span><span class="p">,</span> <span class="n">start_angle2</span>
    <span class="n">start_angle1</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>
    <span class="n">end_angle1</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>
    <span class="n">start_angle2</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>
    <span class="n">end_angle2</span> <span class="o">*=</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span>

    <span class="n">optAngle1</span> <span class="o">=</span> <span class="mf">4.</span> <span class="o">/</span> <span class="mf">3.</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">tan</span><span class="p">((</span><span class="n">end_angle1</span> <span class="o">-</span> <span class="n">start_angle1</span><span class="p">)</span> <span class="o">/</span> <span class="mf">4.</span><span class="p">)</span> <span class="o">*</span> <span class="n">radius</span>
    <span class="n">optAngle2</span> <span class="o">=</span> <span class="mf">4.</span> <span class="o">/</span> <span class="mf">3.</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">tan</span><span class="p">((</span><span class="n">end_angle2</span> <span class="o">-</span> <span class="n">start_angle2</span><span class="p">)</span> <span class="o">/</span> <span class="mf">4.</span><span class="p">)</span> <span class="o">*</span> <span class="n">radius</span>
    <span class="n">rchord</span> <span class="o">=</span> <span class="n">radius</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">chord_width</span><span class="p">)</span>

    <span class="n">vertsPath</span> <span class="o">=</span> <span class="p">[</span><span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle1</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle1</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">optAngle1</span><span class="p">,</span> <span class="n">start_angle1</span> <span class="o">+</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle1</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">optAngle1</span><span class="p">,</span> <span class="n">end_angle1</span> <span class="o">-</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle1</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">rchord</span><span class="p">,</span> <span class="n">end_angle1</span><span class="p">),</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">rchord</span><span class="p">,</span> <span class="n">start_angle2</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle2</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle2</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">optAngle2</span><span class="p">,</span> <span class="n">start_angle2</span> <span class="o">+</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle2</span><span class="p">)</span> <span class="o">+</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">optAngle2</span><span class="p">,</span> <span class="n">end_angle2</span> <span class="o">-</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">end_angle2</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">rchord</span><span class="p">,</span> <span class="n">end_angle2</span><span class="p">),</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">rchord</span><span class="p">,</span> <span class="n">start_angle1</span><span class="p">),</span>
                 <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">start_angle1</span><span class="p">)]</span>

    <span class="n">codesPath</span> <span class="o">=</span> <span class="p">[</span><span class="n">Path</span><span class="o">.</span><span class="n">MOVETO</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span>
                 <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">CURVE4</span><span class="p">]</span>

    <span class="k">if</span> <span class="n">ax</span> <span class="o">==</span> <span class="kc">None</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">vertsPath</span><span class="p">,</span> <span class="n">codesPath</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">path</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="n">vertsPath</span><span class="p">,</span> <span class="n">codesPath</span><span class="p">)</span>
        <span class="n">patch</span> <span class="o">=</span> <span class="n">patches</span><span class="o">.</span><span class="n">PathPatch</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">facecolor</span><span class="o">=</span><span class="n">color</span> <span class="o">+</span> <span class="p">(</span><span class="mf">0.5</span><span class="p">,),</span> <span class="n">edgecolor</span><span class="o">=</span><span class="n">color</span> <span class="o">+</span> <span class="p">(</span><span class="mf">0.4</span><span class="p">,),</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">patch</span><span class="p">)</span>
        <span class="k">return</span> <span class="p">(</span><span class="n">patch</span><span class="p">)</span></div>


<div class="viewcode-block" id="hover_over_bin"><a class="viewcode-back" href="../../../../tutorials/visualization.html#jmetal.lab.visualization.chord_plot.hover_over_bin">[docs]</a><span class="k">def</span> <span class="nf">hover_over_bin</span><span class="p">(</span><span class="n">event</span><span class="p">,</span> <span class="n">handle_tickers</span><span class="p">,</span> <span class="n">handle_plots</span><span class="p">,</span> <span class="n">colors</span><span class="p">,</span> <span class="n">fig</span><span class="p">):</span>
    <span class="n">is_found</span> <span class="o">=</span> <span class="kc">False</span>

    <span class="k">for</span> <span class="n">iobj</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">handle_tickers</span><span class="p">)):</span>
        <span class="k">for</span> <span class="n">ibin</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">handle_tickers</span><span class="p">[</span><span class="n">iobj</span><span class="p">])):</span>
            <span class="n">cont</span> <span class="o">=</span> <span class="kc">False</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">is_found</span><span class="p">:</span>
                <span class="n">cont</span><span class="p">,</span> <span class="n">ind</span> <span class="o">=</span> <span class="n">handle_tickers</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">ibin</span><span class="p">]</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">cont</span><span class="p">:</span>
                    <span class="n">is_found</span> <span class="o">=</span> <span class="kc">True</span>
            <span class="k">if</span> <span class="n">cont</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">handle_tickers</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">ibin</span><span class="p">],</span> <span class="n">facecolor</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">])</span>
                <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">set_visible</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span> <span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">ibin</span><span class="p">]]</span>
                <span class="n">is_found</span> <span class="o">=</span> <span class="kc">True</span>
                <span class="n">fig</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">draw_idle</span><span class="p">()</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">handle_tickers</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">ibin</span><span class="p">],</span> <span class="n">facecolor</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
                <span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">ibin</span><span class="p">]:</span>
                    <span class="n">h</span><span class="o">.</span><span class="n">set_visible</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>
                <span class="n">fig</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">draw_idle</span><span class="p">()</span></div>


<div class="viewcode-block" id="chord_diagram"><a class="viewcode-back" href="../../../../tutorials/visualization.html#jmetal.lab.visualization.chord_plot.chord_diagram">[docs]</a><span class="k">def</span> <span class="nf">chord_diagram</span><span class="p">(</span><span class="n">solutions</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">FloatSolution</span><span class="p">],</span> <span class="n">nbins</span><span class="o">=</span><span class="s1">&#39;auto&#39;</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">obj_labels</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                  <span class="n">prop_labels</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">13</span><span class="p">,</span> <span class="n">ha</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">va</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">),</span> <span class="n">pad</span><span class="o">=</span><span class="mi">6</span><span class="p">):</span>
    <span class="n">points_matrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">s</span><span class="o">.</span><span class="n">objectives</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">solutions</span><span class="p">])</span>
    <span class="p">(</span><span class="n">NPOINTS</span><span class="p">,</span> <span class="n">NOBJ</span><span class="p">)</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="n">points_matrix</span><span class="p">)</span>

    <span class="n">HSV_tuples</span> <span class="o">=</span> <span class="p">[(</span><span class="n">x</span> <span class="o">*</span> <span class="mf">1.0</span> <span class="o">/</span> <span class="n">NOBJ</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">)]</span>
    <span class="n">colors</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">colorsys</span><span class="o">.</span><span class="n">hsv_to_rgb</span><span class="p">(</span><span class="o">*</span><span class="n">x</span><span class="p">),</span> <span class="n">HSV_tuples</span><span class="p">))</span>

    <span class="k">if</span> <span class="n">ax</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
        <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">axes</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">aspect</span><span class="o">=</span><span class="s1">&#39;equal&#39;</span><span class="p">)</span>

    <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim</span><span class="p">(</span><span class="o">-</span><span class="mf">2.3</span><span class="p">,</span> <span class="mf">2.3</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim</span><span class="p">(</span><span class="o">-</span><span class="mf">2.3</span><span class="p">,</span> <span class="mf">2.3</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s1">&#39;off&#39;</span><span class="p">)</span>

    <span class="n">y</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.</span> <span class="o">/</span> <span class="n">NOBJ</span><span class="p">]</span> <span class="o">*</span> <span class="n">NOBJ</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">360</span> <span class="o">-</span> <span class="n">pad</span> <span class="o">*</span> <span class="n">NOBJ</span><span class="p">)</span>
    <span class="n">sector_angles</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="n">labels_pos_and_ros</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="n">start_angle</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">):</span>
        <span class="n">end_angle</span> <span class="o">=</span> <span class="n">start_angle</span> <span class="o">+</span> <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
        <span class="n">sector_angles</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">start_angle</span><span class="p">,</span> <span class="n">end_angle</span><span class="p">))</span>
        <span class="n">angle_diff</span> <span class="o">=</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="p">(</span><span class="n">start_angle</span> <span class="o">+</span> <span class="n">end_angle</span><span class="p">)</span>
        <span class="k">if</span> <span class="o">-</span><span class="mi">30</span> <span class="o">&lt;=</span> <span class="n">angle_diff</span> <span class="o">&lt;=</span> <span class="mi">210</span><span class="p">:</span>
            <span class="n">angle_diff</span> <span class="o">-=</span> <span class="mi">90</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">angle_diff</span> <span class="o">-=</span> <span class="mi">270</span>
        <span class="n">angleText</span> <span class="o">=</span> <span class="n">start_angle</span> <span class="o">-</span> <span class="mf">2.5</span>
        <span class="k">if</span> <span class="o">-</span><span class="mi">30</span> <span class="o">&lt;=</span> <span class="n">angleText</span> <span class="o">&lt;=</span> <span class="mi">210</span><span class="p">:</span>
            <span class="n">angleText</span> <span class="o">-=</span> <span class="mi">90</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">angleText</span> <span class="o">-=</span> <span class="mi">270</span>

        <span class="n">labels_pos_and_ros</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
            <span class="nb">tuple</span><span class="p">(</span><span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="p">(</span><span class="n">start_angle</span> <span class="o">+</span> <span class="n">end_angle</span><span class="p">)</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">))</span> <span class="o">+</span> <span class="p">(</span><span class="n">angle_diff</span><span class="p">,)</span> <span class="o">+</span>
            <span class="nb">tuple</span><span class="p">(</span><span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.725</span><span class="p">,</span> <span class="p">(</span><span class="n">start_angle</span> <span class="o">-</span> <span class="mf">2.5</span><span class="p">)</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">))</span> <span class="o">+</span> <span class="p">(</span><span class="n">angleText</span><span class="p">,)</span> <span class="o">+</span>
            <span class="nb">tuple</span><span class="p">(</span><span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.85</span><span class="p">,</span> <span class="p">(</span><span class="n">start_angle</span> <span class="o">-</span> <span class="mf">2.5</span><span class="p">)</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">))</span> <span class="o">+</span> <span class="p">(</span><span class="n">angleText</span><span class="p">,))</span>
        <span class="n">start_angle</span> <span class="o">=</span> <span class="n">end_angle</span> <span class="o">+</span> <span class="n">pad</span>

    <span class="n">arc_points</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">for</span> <span class="n">point</span> <span class="ow">in</span> <span class="n">points_matrix</span><span class="p">:</span>
        <span class="n">arc_points</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span>
        <span class="n">idim</span> <span class="o">=</span> <span class="mi">0</span>

        <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">point</span><span class="p">:</span>
            <span class="n">anglePoint</span> <span class="o">=</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">idim</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="p">(</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">idim</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">idim</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span> <span class="o">*</span> <span class="n">point</span><span class="p">[</span><span class="n">idim</span><span class="p">]</span>
            <span class="n">arc_points</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">anglePoint</span><span class="p">,</span> <span class="n">anglePoint</span><span class="p">))</span>
            <span class="n">idim</span> <span class="o">=</span> <span class="n">idim</span> <span class="o">+</span> <span class="mi">1</span>

    <span class="n">max_hist_values</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="n">handle_tickers</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="n">handle_plots</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="k">for</span> <span class="n">iobj</span> <span class="ow">in</span> <span class="n">tqdm</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">),</span> <span class="n">ascii</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="s1">&#39;Chord diagram&#39;</span><span class="p">):</span>
        <span class="n">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">end_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.925</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mf">0.225</span><span class="p">,</span>
                    <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span>
                    <span class="n">fc</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">),</span> <span class="n">ec</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">z_order</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
        <span class="n">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">end_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.925</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mf">0.05</span><span class="p">,</span>
                    <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span>
                    <span class="n">fc</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">ec</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">z_order</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
        <span class="n">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">end_angle</span><span class="o">=</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.7</span> <span class="o">+</span> <span class="mf">0.15</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span>
                    <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span> <span class="n">fc</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">ec</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">ls</span><span class="o">=</span><span class="s1">&#39;:&#39;</span><span class="p">,</span> <span class="n">z_order</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>

        <span class="n">histValues</span><span class="p">,</span> <span class="n">binsDim</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">histogram</span><span class="p">(</span><span class="n">points_matrix</span><span class="p">[:,</span> <span class="n">iobj</span><span class="p">],</span> <span class="n">bins</span><span class="o">=</span><span class="n">nbins</span><span class="p">)</span>
        <span class="n">relativeHeightBinPre</span> <span class="o">=</span> <span class="mf">0.025</span>
        <span class="n">max_hist_values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">histValues</span><span class="p">))</span>
        <span class="n">handle_tickers</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span>
        <span class="n">handle_plots</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span>

        <span class="k">for</span> <span class="n">indexBin</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">histValues</span><span class="p">)):</span>
            <span class="n">startAngleBin</span> <span class="o">=</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="p">(</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span> <span class="o">*</span> <span class="n">binsDim</span><span class="p">[</span>
                <span class="n">indexBin</span><span class="p">]</span>
            <span class="n">endAngleBin</span> <span class="o">=</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="p">(</span><span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span> <span class="o">*</span> <span class="n">binsDim</span><span class="p">[</span>
                <span class="n">indexBin</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span>
            <span class="n">relativeHeightBin</span> <span class="o">=</span> <span class="mf">0.15</span> <span class="o">*</span> <span class="n">histValues</span><span class="p">[</span><span class="n">indexBin</span><span class="p">]</span> <span class="o">/</span> <span class="nb">max</span><span class="p">(</span><span class="n">histValues</span><span class="p">)</span>
            <span class="n">handle_tickers</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
                <span class="n">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="n">startAngleBin</span><span class="p">,</span> <span class="n">end_angle</span><span class="o">=</span><span class="n">endAngleBin</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.69</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mf">0.08</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                            <span class="n">fc</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">ec</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)))</span>
            <span class="n">handle_plots</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span>

            <span class="k">if</span> <span class="n">histValues</span><span class="p">[</span><span class="n">indexBin</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                <span class="n">draw_sector</span><span class="p">(</span><span class="n">start_angle</span><span class="o">=</span><span class="n">startAngleBin</span><span class="p">,</span> <span class="n">end_angle</span><span class="o">=</span><span class="n">endAngleBin</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.7</span> <span class="o">+</span> <span class="n">relativeHeightBin</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
                            <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">fc</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">ec</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">])</span>
                <span class="n">plotPoint1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.7</span> <span class="o">+</span> <span class="n">relativeHeightBinPre</span><span class="p">,</span> <span class="n">startAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plotPoint2</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.7</span> <span class="o">+</span> <span class="n">relativeHeightBin</span><span class="p">,</span> <span class="n">startAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span> <span class="p">[</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">1</span><span class="p">]],</span> <span class="n">c</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
                <span class="n">relativeHeightBinPre</span> <span class="o">=</span> <span class="n">relativeHeightBin</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">plotPoint1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.7</span> <span class="o">+</span> <span class="n">relativeHeightBinPre</span><span class="p">,</span> <span class="n">startAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plotPoint2</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.725</span> <span class="o">+</span> <span class="n">relativeHeightBin</span><span class="p">,</span> <span class="n">startAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span> <span class="p">[</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">1</span><span class="p">]],</span> <span class="n">c</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
                <span class="n">relativeHeightBinPre</span> <span class="o">=</span> <span class="mf">0.025</span>
            <span class="k">if</span> <span class="n">indexBin</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">histValues</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span>
                <span class="n">plotPoint1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.7</span> <span class="o">+</span> <span class="n">relativeHeightBin</span><span class="p">,</span> <span class="n">endAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plotPoint2</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.725</span><span class="p">,</span> <span class="n">endAngleBin</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span> <span class="p">[</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">1</span><span class="p">]],</span> <span class="n">c</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>

            <span class="k">for</span> <span class="n">ipoint</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">points_matrix</span><span class="p">)):</span>
                <span class="n">plotPoint1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.6</span><span class="p">,</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plotPoint2</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.6</span><span class="p">,</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">iobj</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span> <span class="p">[</span><span class="n">plotPoint1</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">plotPoint2</span><span class="p">[</span><span class="mi">1</span><span class="p">]],</span> <span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
                         <span class="n">c</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>

                <span class="k">if</span> <span class="n">binsDim</span><span class="p">[</span><span class="n">indexBin</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">points_matrix</span><span class="p">[</span><span class="n">ipoint</span><span class="p">,</span> <span class="n">iobj</span><span class="p">]</span> <span class="o">&lt;=</span> <span class="n">binsDim</span><span class="p">[</span>
                    <span class="n">indexBin</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]:</span>
                    <span class="k">for</span> <span class="n">jdim</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">):</span>
                        <span class="k">if</span> <span class="n">jdim</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
                            <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">indexBin</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
                                <span class="n">draw_chord</span><span class="p">(</span><span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">jdim</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">jdim</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span>
                                           <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">jdim</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="n">jdim</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.55</span><span class="p">,</span>
                                           <span class="n">color</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">chord_width</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">))</span>
                            <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">indexBin</span><span class="p">][</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">set_visible</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>
                    <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">indexBin</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
                        <span class="n">draw_chord</span><span class="p">(</span><span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
                                   <span class="n">arc_points</span><span class="p">[</span><span class="n">ipoint</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="mf">0.55</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">iobj</span><span class="p">],</span> <span class="n">chord_width</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">))</span>
                    <span class="n">handle_plots</span><span class="p">[</span><span class="n">iobj</span><span class="p">][</span><span class="n">indexBin</span><span class="p">][</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">set_visible</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>

    <span class="k">if</span> <span class="n">obj_labels</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">obj_labels</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;$f_{&#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;}(\mathbf</span><span class="si">{x}</span><span class="s1">)$&#39;</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">)]</span>

    <span class="n">prop_legend_bins</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">9</span><span class="p">,</span> <span class="n">ha</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">va</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">)</span>

    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">NOBJ</span><span class="p">):</span>
        <span class="n">p0</span><span class="p">,</span> <span class="n">p1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.975</span><span class="p">,</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">p0</span><span class="p">,</span> <span class="n">p1</span><span class="p">,</span> <span class="s1">&#39;0&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">prop_legend_bins</span><span class="p">)</span>
        <span class="n">p0</span><span class="p">,</span> <span class="n">p1</span> <span class="o">=</span> <span class="n">polar_to_cartesian</span><span class="p">(</span><span class="mf">0.975</span><span class="p">,</span> <span class="n">sector_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">p0</span><span class="p">,</span> <span class="n">p1</span><span class="p">,</span> <span class="s1">&#39;1&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">prop_legend_bins</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span> <span class="n">obj_labels</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">rotation</span><span class="o">=</span><span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
                <span class="o">**</span><span class="n">prop_labels</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">3</span><span class="p">],</span> <span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">4</span><span class="p">],</span> <span class="s1">&#39;0&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">prop_legend_bins</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">6</span><span class="p">],</span> <span class="n">labels_pos_and_ros</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">7</span><span class="p">],</span> <span class="nb">str</span><span class="p">(</span><span class="n">max_hist_values</span><span class="p">[</span><span class="n">i</span><span class="p">]),</span> <span class="o">**</span><span class="n">prop_legend_bins</span><span class="p">,</span>
                <span class="n">color</span><span class="o">=</span><span class="n">colors</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>

    <span class="n">plt</span><span class="o">.</span><span class="n">axis</span><span class="p">([</span><span class="o">-</span><span class="mf">1.2</span><span class="p">,</span> <span class="mf">1.2</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.2</span><span class="p">,</span> <span class="mf">1.2</span><span class="p">])</span>
    <span class="n">fig</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">mpl_connect</span><span class="p">(</span><span class="s2">&quot;motion_notify_event&quot;</span><span class="p">,</span>
                           <span class="k">lambda</span> <span class="n">event</span><span class="p">:</span> <span class="n">hover_over_bin</span><span class="p">(</span><span class="n">event</span><span class="p">,</span> <span class="n">handle_tickers</span><span class="p">,</span> <span class="n">handle_plots</span><span class="p">,</span> <span class="n">colors</span><span class="p">,</span> <span class="n">fig</span><span class="p">))</span>
    <span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span></div>
</pre></div>

          </div>
            
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../index.html">jMetalPy 1.5.1 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li> 
      </ul>
    </div>
<script type="text/javascript">
  $("#mobile-toggle a").click(function () {
    $("#left-column").toggle();
  });
</script>
<script type="text/javascript" src="../../../../_static/js/bootstrap.js"></script>
  <div class="footer">
    &copy; Copyright 2019, Antonio Benítez-Hidalgo. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  </div>
  </body>
</html>